﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace QuanLySim
{
    public partial class frmLoGo : Form
    {
        #region variable
        private frmQuanLySim m_ql;
        private bool m_DangNhap;
        private string m_strTenDangNhap;
        #endregion

        #region method
        public frmLoGo()
        {
            InitializeComponent();
            m_ql = new frmQuanLySim();
            m_DangNhap = false;
        }

        private Form SF
        {
            set
            {
                foreach (Form frm in this.MdiChildren)
                {
                    //if (frm.Name == value.Name)
                    //{
                    //    frm.BringToFront();
                    //    return;
                    //}
                    //else
                    //{
                    //    frm.Close();
                    //}
                    frm.Close();
                }
                
                value.MdiParent = this;
                value.Show();
            }
        }
        #endregion

        #region "ptbx.._click"
        private void ptbxViettel_Click(object sender, EventArgs e)
        {
            SF = new frmTimKiem("Viettel");
        }

        private void ptbxMobifone_Click(object sender, EventArgs e)
        {
            SF = new frmTimKiem("Mobifone");
        }

        private void ptbxVinafone_Click(object sender, EventArgs e)
        {
            SF = new frmTimKiem("Vinaphone");
        }

        private void ptbxVietnammobile_Click(object sender, EventArgs e)
        {
            SF = new frmTimKiem("Vietnamobile");
        }

        private void ptbxBeeline_Click(object sender, EventArgs e)
        {
            SF = new frmTimKiem("Beeline");
        }

        private void ptbxSfone_Click(object sender, EventArgs e)
        {
            SF = new frmTimKiem("Sfone");
        }

        private void ptbxEvntelecom_Click(object sender, EventArgs e)
        {
            SF = new frmTimKiem("EVNTelecom");
        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            if (DialogResult.Yes == MessageBox.Show("Có chắc muốn thoát ?", "Lưu ý", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
            {
                this.Close();
            }
        }
        private void btnQuanLy_Click(object sender, EventArgs e)
        {
            if (!m_DangNhap)
            {
                frmDangNhap dn = new frmDangNhap();
                dn.ShowDialog();
                m_DangNhap = dn.DANGNHAP;
                m_strTenDangNhap = dn.TENDANGNHAP;
            }
            if (m_DangNhap)
            {
                this.btnDangThoat.Visible = true;
                SF = new frmQuanLySim(m_strTenDangNhap);
            }
        }

        private void btnDangThoat_Click(object sender, EventArgs e)
        {
            m_DangNhap = false;
            this.btnDangThoat.Visible = false;
            SF = new frmTimKiem("Viettel");
        }
        #endregion

        #region ptbx.._Mouse
        private void ptbxViettel_MouseMove(object sender, MouseEventArgs e)
        {
            this.ptbxViettel.Size = new System.Drawing.Size(140, 57);
        }
        private void ptbxViettel_MouseLeave(object sender, EventArgs e)
        {
            this.ptbxViettel.Size = new System.Drawing.Size(140, 77);
        }

        private void ptbxMobifone_MouseLeave(object sender, EventArgs e)
        {
            this.ptbxMobifone.Size = new System.Drawing.Size(140, 77);
        }

        private void ptbxMobifone_MouseMove(object sender, MouseEventArgs e)
        {
            this.ptbxMobifone.Size = new System.Drawing.Size(140, 57);
        }

        private void ptbxVinafone_MouseLeave(object sender, EventArgs e)
        {
            this.ptbxVinafone.Size = new System.Drawing.Size(140, 77);
        }

        private void ptbxVinafone_MouseMove(object sender, MouseEventArgs e)
        {
            this.ptbxVinafone.Size = new System.Drawing.Size(140, 57);
        }

        private void ptbxVietnammobile_MouseLeave(object sender, EventArgs e)
        {
            this.ptbxVietnammobile.Size = new System.Drawing.Size(140, 77);
        }

        private void ptbxVietnammobile_MouseMove(object sender, MouseEventArgs e)
        {
            this.ptbxVietnammobile.Size = new System.Drawing.Size(140, 57);
        }

        private void ptbxBeeline_MouseLeave(object sender, EventArgs e)
        {
            this.ptbxBeeline.Size = new System.Drawing.Size(140, 77);
        }

        private void ptbxBeeline_MouseMove(object sender, MouseEventArgs e)
        {
            this.ptbxBeeline.Size = new System.Drawing.Size(140, 57);
        }

        private void ptbxSfone_MouseLeave(object sender, EventArgs e)
        {
            this.ptbxSfone.Size = new System.Drawing.Size(140, 77);
        }

        private void ptbxSfone_MouseMove(object sender, MouseEventArgs e)
        {
            this.ptbxSfone.Size = new System.Drawing.Size(140, 57);
        }

        private void ptbxEvntelecom_MouseLeave(object sender, EventArgs e)
        {
            this.ptbxEvntelecom.Size = new System.Drawing.Size(140, 77);
        }

        private void ptbxEvntelecom_MouseMove(object sender, MouseEventArgs e)
        {
            this.ptbxEvntelecom.Size = new System.Drawing.Size(140, 57);
        }
        #endregion
        private void Form1_Load(object sender, EventArgs e)
        {
            SF = new frmTimKiem("Viettel");
        }
    }
}